package com.qianbei.common.loading;

import android.os.Parcelable;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import java.util.ArrayList;

public class GuideViewPagerAdapter extends PagerAdapter 
{
	private ArrayList<Object> viewList;

	public GuideViewPagerAdapter(ArrayList<Object> viewList) 
	{
		this.viewList = viewList;
	}

	@Override
	public void setPrimaryItem(ViewGroup container, int position, Object object) {
	}

	@Override
	public void destroyItem(View container, int position, Object object) {
		((ViewPager) container).removeView((ImageView) viewList.get(position));
	}

	@Override
	public Object instantiateItem(View container, int position) 
	{
		// TODO Auto-generated method stub
		View view = (ImageView) viewList.get(position);
		((ViewPager) container).addView(view, 0);
		return view;
	}

	@Override
	public int getCount() {
		return viewList.size();
	}

	@Override
	public boolean isViewFromObject(View arg0, Object arg1) {
		return arg0 == arg1;
	}

	@Override
	public void finishUpdate(View arg0) {
		// TODO Auto-generated method stub
	}

	@Override
	public void restoreState(Parcelable arg0, ClassLoader arg1) {
		// TODO Auto-generated method stub
	}

	@Override
	public Parcelable saveState() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void startUpdate(View arg0) {
		// TODO Auto-generated method stub
	}
}